
package com.idealighter.game.login.handler;

import com.google.inject.Inject;
import com.idealighter.game.core.annotation.ReqMsgHandler;
import com.idealighter.game.login.manager.LoginMgr;
import com.idealighter.game.login.message.ReqWeChatLoginMsg;
import com.idealighter.game.message.ModuleMsgIdConstant;
import com.idealighter.game.message.core.ReqMessage;
import com.idealighter.game.message.core.ResMessage;
import com.idealighter.game.player.struct.Player;
import com.idealighter.game.server.handler.ReqMessageHandler;


@ReqMsgHandler(ModuleMsgIdConstant.Account.WE_CHAT_LOGIN)
public class ReqWeChatLoginHandler implements ReqMessageHandler {

  @Inject
  private LoginMgr loginMgr;

  @Override
  public ResMessage action(Player player, ReqMessage message) {
    ReqWeChatLoginMsg msg = (ReqWeChatLoginMsg) message;
    return loginMgr.weChatLogin(player, msg.getUnionId(), msg.getNickName(), msg.getPlatform(),
        msg.getSex(), msg.getCountry(), msg.getHeadUrl());
  }
}
